// use lazy_static::lazy_static;

use std::{
    env::{self},
    sync::LazyLock,
};

const ENV_MODE_NAME: &str = "OP_ENV_MODE";

const DEV_MODE: &str = "dev";
// const RELEASE_MODE: &str = "release";
// const TEST_MODE: &str = "test";

// lazy_static! {
//     pub static ref CURRENT_ENV_MODE: EnvMode = EnvMode {
//         current: get_current_mode(),
//     };
// }

// [LazyLock] is build-in feature similar with [lazy_static!] since rust 1.80
pub static CURRENT_ENV_MODE: LazyLock<EnvMode> = LazyLock::new(|| EnvMode {
    current: get_current_mode(),
});

#[derive(Debug)]
pub struct EnvMode {
    pub current: String,
}

// pub fn is_debug_mode() -> bool {
//     get_current_mode() == DEBUG_MODE
// }

fn get_current_mode() -> String {
    env::var(ENV_MODE_NAME).unwrap_or(String::from(DEV_MODE))
}
